#ifndef __TXN_STAT_TOOL_H__
#define __TXN_STAT_TOOL_H__

#include <noncopyable.h>
#include <stat_manager.h>
#include <cgi_control.h>

HTTP_SVR_NS_BEGIN

class CTxnStatTool : private noncopyable
{
public: //method
    CTxnStatTool (void);
    ~CTxnStatTool (void);

    static CTxnStatTool* Instance (void);
    static void Destroy (void);

    int open (const char* statfile, const char* cgixmlfile, const char* output_stat_file, int check_interval);
    int close (void);

    void write_msg(const char *format, ...);
    int print (void);

public: //property

protected:
protected:

private: //method
private: //property
    TStatHeadInfo*  _statinfo;
    TCGIControl*    _cgi_control;

    TItemU32 last_web_req_count;
    TItemU32 last_web_rsp_count;
    TItemU32 last_helper_req_count;
    TItemU32 last_helper_rsp_count;
    TItemU32 last_cgi_req_count[MAX_CGI_COUNT];
    TItemU32 last_cgi_rsp_count[MAX_CGI_COUNT];

    char _output_file[256];
    int  _check_interval;
};

HTTP_SVR_NS_END

#endif  //__TXN_STAT_TOOL_H__
